package com.sgb.knowledgeshare.viewmodel;

import androidx.lifecycle.ViewModel;

import com.sgb.knowledgeshare.ShareConfig;
import com.swgk.core.base.api.ICallBack;
import com.swgk.core.view.entity.VideoTypeListEntity;
import com.sgb.knowledgeshare.view.fragment.ShareClassifyFragment;
import com.swgk.core.base.model.entity.BaseEntity;

import java.util.List;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class ShareClassifyModel extends ViewModel {
    ShareClassifyFragment fragment;

    public void setActivity(ShareClassifyFragment shareClassifyFragment) {
        fragment = shareClassifyFragment;
    }

    //    获取发布类型
    public void getvideoTypeList() {
        ShareConfig.getInstance().getApi().getCategoryTree().enqueue(new ICallBack<BaseEntity<List<VideoTypeListEntity>>>() {
            @Override
            public void onSuccess(BaseEntity<List<VideoTypeListEntity>> data) {
                if (data.getData()==null)return;
                if (data.getState().equals("ok")){
                    fragment.setVideoTypeList(data.getData());
                }
            }
        });

    }

}
